package com.sitemap.domain;

/**
 * 更新的频率, 标准支持的有如下几个： "always", "hourly", "daily", "weekly",
 * "monthly", "yearly"
 *
 * @author Hugo
 */
public enum ChangeFreq {

    /**
     * 更新的频率, 标准支持的有如下几个： "always", "hourly", "daily", "weekly",
     * "monthly", "yearly"
     */
    ALWAYS("always"),
    HOUR("hourly"),
    DAY("daily"),
    WEEK("weekly"),
    MONTH("monthly"),
    YEAR("yearly");

    /**
     * 属性名称
     */
    private String changeName;

    ChangeFreq(String changeName) {
        this.changeName = changeName;
    }

    public String getChangeName() {
        return changeName;
    }

    /**
     * 验证字符串是否在该枚举类中
     *
     * @param checkStr 待验证字符串
     * @return true--包含 false--不包含
     */
    public static boolean isContent(String checkStr) {
        for (ChangeFreq changeFreq : ChangeFreq.values()) {
            boolean checkPass = changeFreq.getChangeName().equals(checkStr);
            if (checkPass) {
                return true;
            }
        }
        return false;
    }

}
